package com.hougong.im.utils;

public class RedisKeys {
    /**
     * 数据库配置 ket --> value
     * @param key
     * @return
     */
    public static String getSysConfigKey(String key){
        return "sys:config:" + key;
    }
    /**
     *  sessionid -->  session对象
     * @param sessionId
     * @return
     */
    public static String getShiroSessionKey(String sessionId){
        return "sessionid:" + sessionId;
    }

    /**
     * token:tokenString  -->  TokenEntity
     * @param key
     * @return
     */
    public static String getTokenKey(String key){
        return "token:"+key;
    }
    /**
     * 表示 谁正在和谁聊天  chatting:fromui --> (f:touid || g:togid)
     * @param fromUid
     * @param
     * @return11
     */
    public static String getChattingKey(Long fromUid){
        return "chatting:"+fromUid;
    }

    /**
     * fromuid发给touid的未读个人消息
     * unreadpersonmsg:touid:fromuid --> List<PersonMessageEntity>
     * @param fromUid
     * @param toUid
     * @return
     */
    public static String getUnReadPersonMsgKey(Long fromUid,Long toUid){
        return "unreadpersonmsg:"+toUid+":"+fromUid;
    }

    /**
     * 与朋友的最新对话活跃时间
     * lasttimetof:1  --> map {2:1212,3:11121}
     * @param fromUid
     *
     * @return
     */
    public  static String getChatLastTimeToFriend(Long fromUid){
        return "lasttimetof:"+fromUid;
    }

    /**
     * 群消息 groupmsg:gmid : GroupMessageEntity
     * @param gmsgid
     * @return
     */
    public static String getGroupMessageKey(Long gmsgid){
        return "groupmsg:"+gmsgid;
    }

    /**
     * 群成员 groupmember:gid  -- >Set集合
     * @param gid
     * @return
     */
    public static String getGroupMemberSetKey(Long gid){
        return "groupmember:"+gid;
    }

    /**
     *  未读群消息 "unreadgroupmsg:"+uid+":"+gid  ===> list<群消息id>
     * @param uid
     * @param gid
     * @return
     */
    public static String getUnReadGroupMsgKey(Long uid,Long gid){
        return "unreadgroupmsg:"+uid+":"+gid;
    }
    /**
     * 与群的最新对话活跃时间
     * lasttimetof:1  --> map {2:1212,3:11121}
     * @param fromUid
     *
     * @return
     */
    public  static String getChatLastTimeToGroup(Long fromUid){
        return "lasttimetog:"+fromUid;
    }

}
